package avicit.bdp.dgs.mdm.utils.enums;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2023-12-07
 * @类说明：
 * @修改记录：
 */
public enum PushStatus {
    WAIT_PUSH(1, "待推送"),
    PUSHING(2, "推送中"),
    PUSHED(3, "已推送"),
    PUSH_FAIL(4, "推送失败");

    private final int code;

    private final String desc;

    PushStatus(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(Integer code) {
        if (code != null) {
            PushStatus[] values = PushStatus.values();
            for (PushStatus obj : values) {
                if (obj.getCode() == code) {
                    return obj.getDesc();
                }
            }
        }

        return null;
    }

    public static PushStatus getTypeByCode(Integer code) {
        if (code != null) {
            PushStatus[] values = PushStatus.values();
            for (PushStatus obj : values) {
                if (obj.getCode() == code) {
                    return obj;
                }
            }
        }

        return null;
    }
}
